# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  include SimpleCaptcha::ControllerHelpers
  include FaceboxRender
  helper :all # include all helpers, all the time
  protect_from_forgery # See ActionController::RequestForgeryProtection for details

  helper_method :user_login?, :current_user, :get_course_image

  def current_user
    @current_user ||= Account.find(session[:account_id]).user
  rescue
    return nil
  end

  def user_login?
    !current_user.nil?
  end

  def get_course_image_url(course)
    "http://+++course_image++++"
  end

  def get_user_image_url(course)
    "http://+++user_image++++"
  end
  # Scrub sensitive parameters from your log
  # filter_parameter_logging :password
end
